#!/bin/bash
echo "testcase:"
python create_task_list.py "$@"

# 如果没有传递任何参数,退出脚本
if [ -z "$@" ]; then
    echo "No test directory specified. Exiting..."
    exit 1
fi

# 切换到 ../mugen 目录
cd ../mugen

# 读取 testlist.txt 文件中的每一行
while read line; do
    echo "Executing command: $line" >> ../mugen-logs/QAteam/mugen/"$@"/alltest.log
    # 执行当前行的 shell 命令,并将标准输出和标准错误输出都写入到 alltest.log
    output=$(eval "$line" 2>&1)
    result=$?
    echo "$output" >> ../mugen-logs/QAteam/mugen/"$@"/alltest.log
    echo -e "\n" >> ../mugen-logs/QAteam/mugen/"$@"/alltest.log
done < ../mugen-logs/QAteam/mugen/"$@"/testlist.txt

cp -rf --no-clobber ../mugen/logs ../mugen-logs/$(uname -m)
